/*******************************************************************************
 * Copyright (c) 2010, 2010 Xbeam Project and ChenZhiKong.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 *******************************************************************************/
package org.bellusoft.xbeam.framework;

import java.io.IOException;
import java.net.URL;
import java.util.Dictionary;
import java.util.Enumeration;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;

/**
 * A Module take care of parts of functions of A Bundle: 
 * 1:bundle life cycle management resource;   
 * 2:bundle class and resource load ; 
 * 3:bundle meta data api;  
 */
public interface Module {

	int getState();

	void start(int options) throws BundleException;

	void start() throws BundleException;
	
	void stop(int options) throws BundleException;

	void stop() throws BundleException;

	void uninstall() throws BundleException;

	Dictionary<String, String> getHeaders();

	URL getResource(String name);

	Dictionary<String, String> getHeaders(String locale);

	String getSymbolicName();

	Class< ? > loadClass(String name) throws ClassNotFoundException;

	Enumeration<URL> getResources(String name) throws IOException;

	Enumeration<String> getEntryPaths(String path);

	URL getEntry(String path);

	Enumeration<URL> findEntries(String path, String filePattern,
			boolean recurse);

	Version getVersion();

	/**
	 * @return
	 */
	boolean isExportPackageUsed();

	/**
	 * 
	 */
	boolean unresolve();
	
}
